package com.example.demo.Controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Random;

/**
 * Created with IntelliJ IEDA.
 * Description:
 * User:86186
 * Date:2023-08-11
 * Time:15:10
 */
@RestController
@RequestMapping("/user")
public class UserController {


    @RequestMapping("/getnum")
    public Integer getNumber(){
        return  new Random().nextInt(10);
    }
    @RequestMapping("/getuser")
    public String getuser(){
        System.out.println("执行了 getUser ！");
        return "get user";
    }

    @RequestMapping("/login")
    public String login(){
        Object obj = null;
        obj.hashCode();//空指针异常
        System.out.println("执行了 login ！");
        return "get login";
    }

    @RequestMapping("/reg")
    public String reg(){
        int result = 10 / 0;// 算术异常
        System.out.println("执行了 reg ！");
        return "get reg";
    }
}
